package com.ymatou.alarm.service;

import org.json.JSONObject;

import com.ymatou.query.seller.trading.api.parameter.ExistsResponse;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
/**
*单个保存错误日志Call
*FreeMaker Template自动生成代码
*/
public class SaveSingleCall extends YmatouBaseCall{
	private static String opurl ="Alarm/SaveSingle";
	
	public SaveSingleCall() {
		super(EnvSetup.getSystemUrl("api_alarm"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取Data
	 * 
	 * @return
	 */
	public ExistsResponse getData() {
		ExistsResponse existsResponse = null;
		try {
			existsResponse = (com.ymatou.query.seller.trading.api.parameter.ExistsResponse) FormatUtil
					.GSONToObject(
							DataUtil.Json.parseJsonObj(
									new JSONObject(getReturnData()).get("data")
											.toString()).toString(),
							ExistsResponse.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return existsResponse;
	}

}